/**
 *  renderer.h
 *  AwkwardCubed - Renderer
 *
 *  Date: 20/08/2013
 *
 *  Language: C++
 *
 *  @author Carl mcCaffrey
 *
 */
#ifndef RENDERER_H
#define RENDERER_H

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif // WIN32_LEAN_AND_MEAN
#include <Windows.h>

#include <d3d11.h>
#include <d3dx11.h>
#include <xnamath.h>

#include "globals.h"

typedef struct _RENDERER_DESC{
	HINSTANCE* hInstance;

	XMFLOAT2 wndSize;
	bool wndFullscreen;
	bool wndCursorVisible;

	XMFLOAT4 d3dClearColor;
	bool d3dVSync;
	uint d3dMSAASamples;
} RENDERER_DESC;

class Renderer
{
	private:
		HINSTANCE* hInstance;

		ID3D11Device* d3dDevice;
		ID3D11DeviceContext* d3dContext;
		IDXGISwapChain* d3dSwapChain;

		ID3D11RenderTargetView* d3dBackBuffer;
		ID3D11Texture2D* d3dDepthStencil;
		ID3D11DepthStencilView* d3dDepthStencilView;
		D3D11_VIEWPORT d3dViewport;

		D3D_FEATURE_LEVEL d3dFeatureLevel;
		D3D_DRIVER_TYPE d3dDriverType;

		float d3dClearColor[4];
		bool d3dVSync;
		uint d3dMSAASamples;
		

		HWND wndHandle;
		XMFLOAT2 wndSize;
		bool wndFullscreen;
		bool wndCursorVisible;

	public:
		uint vRAM;
		char vCard[128];

		bool Init(RENDERER_DESC desc);
		void Shutdown(void);

		void SetClearColor(XMFLOAT4 clearColor);

		void ClearRenderTarget(void);
		void Present(void);

		HWND WndHandle(void);
};

#endif // RENDERER_H